package org.example.infrastructure.repository.orm.database;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.example.domain.model.entity.url.UrlShortenerOsStats;
import org.example.domain.model.entity.url.req.UrlShortenerGroupStatsReq;
import org.example.domain.model.entity.url.req.UrlShortenerStatsReq;
import org.example.domain.repository.UrlShortenerOsStatsRepository;
import org.example.infrastructure.persistence.orm.UrlShortenerOsStatsMapper;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;

@Component
@Slf4j
@RequiredArgsConstructor
public class MybatisUrlShortenerOsStatsRepository implements UrlShortenerOsStatsRepository {
    private final UrlShortenerOsStatsMapper urlShortenerOsStatsMapper;

    @Override
    public void insertUrlShortenerOsStats(UrlShortenerOsStats urlShortenerOsStats) {
        urlShortenerOsStatsMapper.insertUrlShortenerOsStats(urlShortenerOsStats);
    }

    @Override
    public List<HashMap<String, Object>> osStatsByUrlShortenerList(UrlShortenerStatsReq urlShortenerStatsReq) {
        return urlShortenerOsStatsMapper.osStatsByUrlShortenerList(urlShortenerStatsReq);
    }

    @Override
    public List<HashMap<String, Object>> osStatsByGroupList(UrlShortenerGroupStatsReq urlShortenerGroupStatsReq) {
        return urlShortenerOsStatsMapper.osStatsByGroupList(urlShortenerGroupStatsReq);
    }
}
